<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/jquery.confirm.css"/>
	</head>
	<body>
		<div class="am-g">
			 {include file='../Common/hy_header.html'}
		<form id="formsearch" >
			<div class="am-u-md-6 am-cf">
				<div class="am-fl" style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">时间</span>
		          		<input value="{$total.startTime|date_format:'Y-m-d'}" data-am-datepicker style="width:180px;" type="text" id="startTime" name="startTime" class="field am-form-field hy-js-search">
		          </div>
		        </div>
				<div class="am-fl" style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">至&nbsp;&nbsp;&nbsp;</span>
		          		<input value="{$total.endTime|date_format:'Y-m-d'}" data-am-datepicker style="width:180px;" type="text" id="endTime" name="endTime" class="field am-form-field hy-js-search">
		          </div>
		        </div>
				<div class="am-fl" style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">昵称</span>
		          		<input value="{$total.nickname}"  style="width:180px;" type="text" id="nickname" name="nickname" class="field am-form-field hy-js-search">
		          </div>
		        </div>
				<div class="am-fl" style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">评论</span>
		          		<input value="{$total.comment}"  style="width:180px;" type="text" id="comment" name="comment" class="field am-form-field hy-js-search">
		          </div>
		        </div>
				
				<div class="am-fl" style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">类型</span>
						<select name="status" id="status" style="width:180px;" class=" field am-form-field">
			               
			               <option value="0">--- ---</option>
			               
			               <option {if $total.status eq 1}selected="selected" {/if} value="1">未审核</option>
						   
			               <option {if $total.status eq 2}selected="selected" {/if} value="2">审核中</option>
			               
			               <option {if $total.status eq 3}selected="selected" {/if} value="3">审核通过</option>
			               
			               <option {if $total.status eq 4}selected="selected" {/if} value="4">审核不通过</option>
						   
			               <option {if $total.status eq 5}selected="selected" {/if} value="5">未经过审核</option>
			                 
			            </select>
		                <span class="am-input-group-btn" style=" height: 45px;padding-left: 50px;">
		                  <button class="am-btn am-btn-default bin-select-searchbtn" type="button">搜索</button>
		                </span>
		          </div>
		        </div>
				<div class="am-fl am-cf">
			          <div class="am-btn-toolbar am-fl">
			            <div class="am-btn-group am-btn-group-xs">
			              <a  href="javascript:void(0);" onclick="clearNopass()" id="Nopass_html"  class="am-btn am-btn-default hy-js-href"><span class="am-icon-plus"></span> 清空未经过审核</a>
			            </div>
			          </div>
				</div>
				<div class="am-fl am-cf">
					 <div class="am-btn-toolbar am-fl">
			            <div class="am-btn-group am-btn-group-xs">
			              <a  href="javascript:void(0);" onclick="temCheckAll()" id="temCheckAll_html"  class="am-btn am-btn-default hy-js-href"><span class="am-icon-plus"></span> 勾选添加至实时审核</a>
			            </div>
			          </div>
			        </div>
				<div class="am-fl am-cf">
					 <div class="am-btn-toolbar am-fl">
			            <div class="am-btn-group am-btn-group-xs">
			              <a  href="javascript:void(0);" onclick="export_excel()" id="export_html"  class="am-btn am-btn-default hy-js-href"><span class="am-icon-plus"></span> 导出审核通过Excel</a>
			            </div>
			          </div>
			        </div>
				</div>
		</form>
     <div class="am-u-md-6 am-cf">
        <div class="am-fl am-cf">
          <div class="am-btn-toolbar am-fl">
			<div class="am-btn-group am-btn-group-xs" style="line-height:31px;margin-left:60px;" >
				时间: <strong style="font-size:18px;color:#0e90d2">{$total.startTime|date_format:"Y-m-d"} </strong>到<strong style="font-size:18px;color:#0e90d2">{$total.endTime|date_format:"Y-m-d"} </strong>
				<br>
				 评论总数<strong style="font-size:18px;color:#0e90d2"> {$total.count|default:'0'} </strong>条
			</div>
				<br>
			 <div class="am-btn-group am-btn-group-xs" style="line-height:31px;margin-left:60px;" >
				  审核通过<strong style="font-size:18px;color:#0e90d2"> {$total.pass_count|default:'0'} </strong>条 - 审核不通过<strong style="font-size:18px;color:#0e90d2"> {$total.nopass_count|default:'0'} </strong>条 - 审核中与未审核<strong style="font-size:18px;color:#0e90d2"> {$total.passing_count|default:'0'} </strong>条 
			</div>
          </div>
        </div>
      </div>
      
      <div class="am-g">
      <div class="am-u-sm-12">
        <div class="am-form">
          <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
              <tr>
              	<th width="10%" class="table-check"><input class="hy-js-selectall" type="checkbox" />全选/全不选</th>
				<th width="7%" class="table-type">昵称</th>
				<th width="13%" class="table-type">openid</th>
				<th width="25%" class="table-type">评论</th>
				<th width="10%" class="table-type">状态</th>
				<th width="10%" class="table-type">加精</th>
				<th width="10%" class="table-author">提交时间</th>
				<th width="15%" class="table-author">操作</th>
				
              </tr>
          </thead>
          <tbody>
          	   <!--{foreach key=key from=$sql_list item=sql}-->
            <tr>
              <td><input class="hy-js-id" name="ids" type="checkbox" data-temp-status="{$sql.status}"  value="{$sql.id}"/></td>
              <td onClick="checkedthis(this)">{$sql.nickname}</td>
              <td onClick="checkedthis(this)">{$sql.openid}</td>
              <td onClick="checkedthis(this)">{$sql.comment|default:" - "}</td>
			  <td onClick="checkedthis(this)">{$sql.statusShow|default:" - "}</td>
			  <td><input {if $sql.addStatus==1}checked=checked{/if} type="checkbox" onclick="addDigest({$sql.id},this)" name="addStatus"></td>
			  <td onClick="checkedthis(this)">{$sql.addtime|date_format:"Y-m-d"}</td>
     		  <td><div><div><a onclick="silence({$sql.wxid})" >禁止该用户发言    </a>{if $sql.status==6}<a onclick="temCheck('{$sql.id}')">临时审核{/if}<a data-param ="{ url:'index.php?g=admin&m=chat&a=delRecord&id={$sql.id}',hide:4}" class=" am-btn-xs am-text-danger hy-js-del" > 删除</a></div></div></td>
            </tr>
                  <!--{/foreach}-->  
          </tbody>
        </table>
          <div class="am-cf">

  <div class="am-fr">
  {$list_page}
  </div>
</div>
          <hr />
      
        </div>
      </div>

    </div>
    </div>
   {include file='../Common/hy_footer.html'}
   <script type="text/javascript" src="{$_C.hy_path}js/Map.js"></script>
   <script type="text/javascript" src="{$_C.hy_path}js/bin.select.js"></script>
   <script src="{$_C.hy_path}js/jquery.confirm.js"></script>
   <script type="text/javascript">
   	$(function(){
	   	$('#startTime').datepicker({
			          dateFormat:'yy-mm-dd hh:mm:ss'//日期格式
	          });
	   	$('#endTime').datepicker({
			          dateFormat:'yy-mm-dd hh:mm:ss'//日期格式
	          });	
	})
	function checkedthis(params){
			if($(params).parent().find("input[name=ids]").attr("checked")!="checked"){
				$(params).parent().find("input[name=ids]").prop("checked","checked");
			}else{
				$(params).parent().find("input[name=ids]").prop('checked',"");
			}
		}
	$('.bin-select-searchbtn').click(function(){
		var url = window.location.href;
           url = url.substring(0,url.indexOf("?"));
		   url+="?g=admin&m=chat&a=record";
		var json = uriJson(bulidFilterParams($("#formsearch")));
		if(json!=""&&json!=null&&json!=undefined){
			window.location.href=url+"&"+json;
		}
	});
	
	function silence(wxid){
		jq_confirm("提醒","确定禁言该用户？",function(status){
			var data = {
				"status":status,
				"wxid":wxid
			}
			var url = "/ws/index.php?g=admin&m=chat&a=silenceUser";
			$.post(url,data,function(res){
				if(res.error==1){
						alert(res.content);
					}else{
						alert(res.content);
					}
			},"json")
		})
	}
	function jq_confirm(title,message,func){
				$.confirm({
				'title'		: title,
				'message'	: message,
				'buttons'	: {
					'禁言1小时'	: {
						'class'	: 'blue',
						'action': function(){
							func(1);
							$.confirm.hide();
						}
					},
					'禁言5天'	: {
						'class'	: 'blue',
						'action': function(){
							func(2);
							$.confirm.hide();
						}
					},
					'取消'	: {
						'class'	: 'gray',
						'action': function(){
							$.confirm.hide();
						}	// Nothing to do in this case. You can as well omit the action property.
					}
				}
			});
		}
	
	function loadPage(where){
		var url = window.location.href;
           url = url.substring(0,url.indexOf("?"));
		   url+="?g=admin&m=chat&a=record";
		var json = uriJson(bulidFilterParams($("#formsearch")));
		if(json!=""&&json!=null&&json!=undefined){
			window.location.href=url+"&"+json+where;
		}else{
			window.location.href=url+where;
		}
	}
	function clearNopass(){
		jq_confirm2("提醒","确定清空全部未审核数据？",function(){
			$("#Nopass_html").html("<span class='am-icon-plus'></span> 清理中...");
			var url = "/ws/index.php?g=admin&m=chat&a=clearNopass";
			$.post(url,"",function(data){
				if(data.error==0){
					$('.bin-select-searchbtn').click();
				}else{
					alert(data.content);
				}
			$("#Nopass_html").html("<span class='am-icon-plus'></span>  清空未审核");
			},'json');
		})
	}
	function jq_confirm2(title,message,func){
				$.confirm({
				'title'		: title,
				'message'	: message,
				'buttons'	: {
					'是'	: {
						'class'	: 'blue',
						'action': function(){
							func();
							$.confirm.hide();
						}
					},
					'否'	: {
						'class'	: 'gray',
						'action': function(){
							$.confirm.hide();
						}	// Nothing to do in this case. You can as well omit the action property.
					}
				}
			});
		}
		function addDigest(id,params){
				var url = "/ws/index.php?g=admin&m=chat&a=addDigest";
				var data={
					'id':id
				}
				$.post(url,data,function(res){
					if(res.error==0){
						//$('.bin-select-searchbtn').click();
					}else{
						params.checked=false;
						alert(res.content);
					}
				},'json');
		}
		function temCheck(id){
				var url = "/ws/index.php?g=admin&m=chat&a=temCheck";
				var data={
					'id':id
				}
				$.post(url,data,function(res){
					if(res.error==0){
						$('.bin-select-searchbtn').click();
					}else{
						alert(res.content);
					}
				},'json');
		}
		function temCheckAll(){
			var uids = '';
			var isCheck = true;
			if ($("input[name='ids']:checked").length > 0) {
				$("input[name='ids']:checked").each(function() {
					if($(this).attr("data-temp-status")!=6&&$(this).attr("data-temp-status")!=7){
						isCheck = false;
					}else{
						uids += "," + $(this).val();
					}
				})
				if(isCheck){
					uids = uids.substring(1);
				}else{
					alert("请选择未经审核的数据");
					return 			
				}
			} else {
				alert("请勾选需要临时添加至弹幕的未经审核数据");
				return;
			}
				var url = "/ws/index.php?g=admin&m=chat&a=temCheck";
				var data={
					'id':uids
				}
				$.post(url,data,function(res){
					if(res.error==0){
						$('.bin-select-searchbtn').click();
					}else{
						alert(res.content);
					}
				},'json');
		}
		function export_excel(){
			$("#export_html").html("<span class='am-icon-plus'></span> 导出中...");
			var json = uriJson(bulidFilterParams($("#formsearch")));
			var url ="/ws/index.php?g=admin&m=chat&a=export_chat_record"+"&"+json;
			window.location.href=url;
			$("#export_html").html("<span class='am-icon-plus'></span> 导出Excel");
			
		}
		
   </script>
	</body>
</html>
